package com.example;

import java.io.IOException;

import com.example.freemark.ITemplateEngine;
import com.example.template.FreeMarkerEngine;
import com.example.template.TemplateConfig;

public class MyCodeGenerator {
	
	public static void main(String[] args) throws IOException {
		String projectPackage = "com.feeling.admin.system";
		String modelName = "SysDictEnum";
		String modelCName = "字典枚举";
		String[] templateFileTypes = new String[] {
			//service
			"service.add","service.config","service.del",
			"service.infoQuery","service.listQuery",
			//枚举
			"common.enum",
			//model
			"model.add","model.info","model.list",
			//控制器
			"controller.all"
			
		};
		
		TemplateConfig config = new TemplateConfig()
		.setProjectPackage(projectPackage)
		.setModelName(modelName)
		.setModelCName(modelCName);
		
		ITemplateEngine engine = new FreeMarkerEngine(
				config);
		
		for(String templateFileType:templateFileTypes) {
			engine.execute(templateFileType);
		}
		Runtime.getRuntime().exec("cmd /c start " + config.getOutPath());
	}
}
